<ui:composition xmlns="http://www.w3.org/1999/xhtml"
	xmlns:ui="http://java.sun.com/jsf/facelets"
	xmlns:h="http://java.sun.com/jsf/html"
	xmlns:f="http://java.sun.com/jsf/core"
	xmlns:p="http://primefaces.org/ui"
	xmlns:oso="http://osoftware.com/facelets"
	template="/WEB-INF/templates/mainSearchLayout.xhtml">

	<ui:define name="title">
			<h:outputText value="#{resourceBundle['movement.title']}" />
	</ui:define>
	
	<ui:define name="searchFields">
		<oso:selectOneMenu id="patientFilter" 
			label="#{resourceBundle['bill.patient']}"
			value="#{movementModel.filter.patient}" 
			converter="patientConverter"
			items="#{movementModel.selectablePatients}" 
			itemLabel="fullName"/>

	</ui:define>

	<ui:define name="listValues">
		<ui:param name="listModel" value="#{movementModel.list}" />
		<ui:param name="targetObject" value="#{movementModel.editedEntity}" />
	</ui:define>

	<ui:define name="searchColumns">
		<p:column sortBy="#{row.date}">
			<f:facet name="header">
				<h:outputText value="#{resourceBundle['movement.date']}" >
					<f:convertDateTime pattern="dd/MM/yyyy" />
				</h:outputText>
			</f:facet>
			<h:outputText value="#{row.date}" />
		</p:column>
		<p:column sortBy="#{row.specialistFee.description}">
			<f:facet name="header">
				<h:outputText value="#{resourceBundle['movement.item']}" />
			</f:facet>
			<h:outputText value="#{row.specialistFee.description}" />
		</p:column>
		<p:column sortBy="#{row.fee}">
			<f:facet name="header">
				<h:outputText value="#{resourceBundle['movement.amount']}" />
			</f:facet>
			<h:outputText value="#{row.movementType == 'NEGATIVE'? -1 * row.fee:row.fee}" />
		</p:column>
		<p:columnGroup type="footer">
			<p:row>  
	            <p:column colspan="2" style="text-align:right"  footerText="Total:"/>
	            <p:column footerText="#{movementModel.totalAmount}" style="text-align:right"/>
	            <p:column style="text-align:right"/>	
            </p:row>             
        </p:columnGroup>
	</ui:define>


</ui:composition>